Allow configuring craftable tabs#230
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| private static string GetVariantKey(bool includeAll, bool modsOnly, bool woodOnly, bool stoneOnly) | ||
| { | ||
| if (includeAll) return "all"; | ||
| if (modsOnly) return "mods"; | ||
| if (woodOnly) return "wood"; | ||
| if (stoneOnly) return "stone"; | ||
| return "van"; | ||
| var def = FindTabDefinition(includeAll, modsOnly, woodOnly, stoneOnly); | ||
| if (def != null && !string.IsNullOrEmpty(def.VariantKey)) return def.VariantKey; | ||
| return DefaultCraftableTab?.VariantKey ?? "van"; |
There was a problem hiding this comment.
Respect custom variant keys when indexing recipes
The new configuration now returns whatever CraftableTabConfig.VariantKey is provided (see GetVariantKey), but the recipe indexer still hard‑codes the original identifiers ("van", "mods", "wood", "stone", "all") when building and applying caches (RecipeIndexVariants, ApplyRecipeIndexVariant, etc.). If a config file renames one of those variants, scans will wait for a non‑existent index because the cache is stored under the old key. To keep the feature working when users customise variant names, derive the variant list for indexing from CraftableTabDefinitions (or the normalised config) rather than the hard‑coded strings.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Summary
- Derived the recipe index variant metadata directly from the configured craftable tabs and used it when kicking off index builds, so caches follow custom variant keys instead of hard-coded names. ShowCraftable/ShowCraftable/ShowCraftableModSystem.csL260-L301 ShowCraftable/ShowCraftable/ShowCraftableModSystem.csL2808-L2879
- Added a shared helper to resolve variant flags and updated recipe index application and scan/rebuild paths to honor renamed variants throughout the workflow. ShowCraftable/ShowCraftable/ShowCraftableModSystem.csL1531-L1555 ShowCraftable/ShowCraftable/ShowCraftableModSystem.csL2628-L2651 ShowCraftable/ShowCraftable/ShowCraftableModSystem.csL3947-L3954
Testing
- ✅
dotnet build ShowCraftable/ShowCraftable.sln -nologo -clp:Summary -warnaserror
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68dcf3d725b8832bbb1b88ff8bef2087